import 'package:equatable/equatable.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_purchased_subscription_cancellation_info.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_purchased_subscription_offer_type.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_purchased_subscription_pause_info.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_purchased_subscription_price_change_status.dart';

abstract class GooglePlayApiPurchasedItem {
  bool get test;

  String get orderId;

  bool get acknowledged;
}

class GooglePlayApiOneTimePurchasedItem extends Equatable implements GooglePlayApiPurchasedItem {
  const GooglePlayApiOneTimePurchasedItem({
    required this.test,
    required this.orderId,
    required this.transactionTime,
    required this.promotional,
    required this.acknowledged,
  });

  @override
  final bool test;

  @override
  final String orderId;

  @override
  final bool acknowledged;

  final DateTime transactionTime;
  final bool promotional;

  @override
  List<Object?> get props {
    return [
      test,
      orderId,
      transactionTime,
      promotional,
      acknowledged,
    ];
  }
}

class GooglePlayApiPurchasedSubscription extends Equatable implements GooglePlayApiPurchasedItem {
  const GooglePlayApiPurchasedSubscription({
    required this.test,
    required this.startTime,
    required this.autoRenewalEnabled,
    required this.acknowledged,
    required this.priceChangeStatus,
    required this.cancellationInfo,
    required this.pauseInfo,
    required this.orderId,
    required this.expirationTime,
    required this.offerType,
  });

  @override
  final bool test;

  @override
  final bool acknowledged;

  @override
  final String orderId;

  final DateTime startTime;
  final bool autoRenewalEnabled;
  final GooglePlayApiPurchasedSubscriptionPriceChangeStatus priceChangeStatus;
  final GooglePlayApiPurchasedSubscriptionCancellationInfo? cancellationInfo;
  final GooglePlayApiPurchasedSubscriptionPauseInfo? pauseInfo;
  final DateTime expirationTime;
  final GooglePlayApiPurchasedSubscriptionOfferType offerType;

  @override
  List<Object?> get props {
    return [
      test,
      startTime,
      autoRenewalEnabled,
      acknowledged,
      priceChangeStatus,
      cancellationInfo,
      pauseInfo,
      orderId,
      expirationTime,
      offerType,
    ];
  }
}
